﻿///<copyright>
/// Copyright © 2009 Stephen Styrchak. All Rights Reserved.
///</copyright>
using System;
using Microsoft.Xna.Framework;

namespace Ferpect.ComponentModel
{
    public class InputEventArgs : EventArgs
    {
        public InputEventArgs(PlayerIndex index)
        {
            this.PlayerIndex = index;
        }

        public PlayerIndex PlayerIndex
        {
            get;
            private set;
        }

        public static readonly InputEventArgs Keyboard = new InputEventArgs((PlayerIndex)(-1));
        public static readonly InputEventArgs PlayerOne = new InputEventArgs(PlayerIndex.One);
        public static readonly InputEventArgs PlayerTwo = new InputEventArgs(PlayerIndex.Two);
        public static readonly InputEventArgs PlayerThree = new InputEventArgs(PlayerIndex.Three);
        public static readonly InputEventArgs PlayerFour = new InputEventArgs(PlayerIndex.Four);

        public static InputEventArgs GetInputEventArgs(PlayerIndex index)
        {
            switch (index)
            {
                case (PlayerIndex)(-1):
                    return InputEventArgs.Keyboard;
                case PlayerIndex.One:
                    return InputEventArgs.PlayerOne;
                case PlayerIndex.Two:
                    return InputEventArgs.PlayerTwo;
                case PlayerIndex.Three:
                    return InputEventArgs.PlayerThree;
                case PlayerIndex.Four:
                    return InputEventArgs.PlayerFour;
            }
            throw new ArgumentOutOfRangeException("index", "Invalid PlayerIndex enum value.");
        }
    }

}
